<!--  -->
<template>
  <div>
    <el-table :data="Refund.slice((currentPage-1)*pagesize,currentPage*pagesize)" style="width: 100%">
      <el-table-column prop="rid" label="序号" width="100%">
      </el-table-column>
      <el-table-column prop="oid" label="订单序号" width="100%">
      </el-table-column>
      <el-table-column prop="uid" label="用户编号" width="100%">
      </el-table-column>
      <el-table-column prop="reason" label="退款理由" width="255%">
      </el-table-column>
      <el-table-column prop="rmoney" label="退款金额" width="200%" >
      </el-table-column>
      <el-table-column label="退款状态" width="160">
        <template slot-scope="scope"> 
          {{ scope.row.rstatus == 0 ? '待处理' : '已退款' }}
        </template>
      </el-table-column>
      <el-table-column label="操作" width="250">
        <template v-slot="scope">
            <el-button type="primary" v-if="scope.row.rstatus == 0" @click="tuikuan(scope.row)">退款</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!--分页区域-->
  <el-pagination
      @size-change="size_change" 
      @current-change="current_change"  
      :current-page="currentPage"  
      :page-sizes="[2,3,5]"  
      :page-size="pagesize"  
      layout="total, sizes, prev, pager, next, jumper"  
      :total="Refund.length"> 
  </el-pagination>
  </div>


</template>
<script >
const axios = require("axios");
axios.defaults.baseURL = '/api/'
export default {
  data() {
    return {
      Refund: [],
      // //添加用户
      // dialogTableVisible: false,
      // //修改用户
      // dialogFormVisible4Edit:false,
      Money:{
        aid:'',
        money: '',
        note:'',
        atime:''
      },
      formLabelWidth: '120px',
       total:0,//总条目数
        pagesize:10,//每页显示条目个数
        currentPage:1,//当前页数
    }
  },
  props: [],
  components: {},
  created() {
    this.findAll();
    this.size_change(5);
  },
  mounted() {
  },
  methods: {
    findAll() {
      axios.get('/refund/findAll').then(res => {
        this.Refund = res.data;
        console.log(res.data);
      })
    },
     size_change(newSize){
       this.pagesize = newSize
   },
   //监听 页码值 改变的事件
   current_change(newPage){
       this.currentPage = newPage
   },
   tuikuan(t){
     axios({
          url:'/refund/tuikuan',
          method:'post',
          data: t
        }).then(res=>{
          console.log(res);
          this.findAll();
        })
   }
    // cancel: function () {
    //   this.$message.info("当前操作已取消")
    //   this.dialogTableVisible = false,
    //   this.dialogFormVisible4Edit=false
    // },
    // addUser: function () {
    //   console.log(this.user.startday);
    //   axios({
    //     method: 'POST',
    //     url: '/users/addUsers',
    //     data: this.user
    //   })
    //     .then((resp) => {
    //       this.dialogTableVisible = false;
    //       this.$message.success("添加成功");
    //       this.findAll();
    //     })
    // },
    // updateUser: function(users){
    //   this.ordered=users;
    //   this.dialogFormVisible4Edit=true
    // },
    // modifyUser: function(){
    //   axios({
    //     method:'PUT',
    //     url:'/users/updateUsers',
    //     data: this.ordered
    //   }).then(res=>{
    //     this.dialogFormVisible4Edit=false,
    //     this.$message.success("修改成功");
    //     this.findAll();
    //   })
    // },
    // deleteMoney: function (Money) {
    //   console.log(Money.oid);
    //   axios({
    //     method: 'delete',
    //     url: '/Money/deleteMoney/' + Money.lid,
    //   })
    //     .then((res) => {
    //       this.$message.success('删除成功');
    //       this.findAll();
    //     })
    // }



  }
};
</script>
<style lang='scss'>
</style>